package com.andaily.web.controller.pub;

import com.andaily.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Shengzhao Li
 */
@Controller
@RequestMapping("/validate")
public class PublicValidateController {

    private UserService userService;

    @RequestMapping("user/register/{code}")
    public String activeRegisterUser(@PathVariable String code, ModelMap model) throws Exception {
        boolean result = userService.activeRegisterUser(code);
        model.addAttribute("result", result);
        return "active_register_user";
    }

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }
}
